package com.tmptSource.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wxy on 2017/9/6.
 */
public enum A1templatecolumnDataresource {
    ColumnOptionTable("1", "从多选项表取数据", 15L),
    OptionSql("2", "optionSql中取sql执行取数据", 16L),
    OptionPage("3", "optionPage中取url执行取数据", 17L),
    ColumnOptionTableKeyEquValue("4", "从多选项表取数据(key等于value)", 29L),
    OptionDataTable("5", "从多选项数据字典取数据", 20198L);

    private final String keyName;
    private final String valueName;
    private Long optionId;//选择指定的optionid后，隐藏哪些列

    A1templatecolumnDataresource(String keyName, String valueName, Long optionId ) {
        this.keyName = keyName;
        this.valueName = valueName;
        this.optionId = optionId;
    }

    public static String explain( String keyName ) {
        return explain( keyName, null ) ;
    }

    public static String explain( String keyName, String unexpectedValue ) {
        for (A1templatecolumnDataresource enum1 : A1templatecolumnDataresource.values()) {
            if (enum1.keyName.equals(keyName)) {
                return enum1.getValueName();
            }
        }
        return unexpectedValue;
    }

    public static List<Map<String,String>> toList () {
        List <Map<String,String>> list = new ArrayList();
        for (A1templatecolumnDataresource enum1 : A1templatecolumnDataresource.values()) {
            Map<String,String> map = new HashMap();
            map.put("keyName", enum1.getKeyName());
            map.put("valueName", enum1.getValueName());
            map.put("optionId", String.valueOf(enum1.getOptionId()));
            list.add(map);
        }
        return list;
    }

    public String getKeyName() {
        return keyName;
    }

    public String getValueName() {
        return valueName;
    }
    public Long getOptionId() {
        return optionId;
    }
}
